//
//@File    :	14.12_workmi.cpp
//@Time    :	2022/01/25 14:38:16
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	multiple inheritance(MI)多重继承
//

#include <iostream>
#include <cstring>
#include "14.10_workermi.h"
const int SIZE = 5;

int main()
{
    using std::cin;
    using std::cout;
    using std::endl;
    using std::strchr;

    Worker *lolas[SIZE];

    int ct;
    for (ct = 0; ct < SIZE; ct++)
    {
        char choice;
        cout << "ENter the employee category:\n"
             << "w:waiter s:ginger "
             << "t:singing waiter q:quit\n";
        cin >> choice;
        //输入不是wstq其中一个时,重复提醒
        while (strchr("wstq", choice) == NULL)
        {
            cout << "Please enter a w,s,t,or,q:";
            cin >> choice;
        }
        //输入q时退出
        if (choice == 'q')
        {
            break;
        }
        //输入w s t时,新建对应的对象
        switch (choice)
        {
        case 'w':
            lolas[ct] = new Waiter;
            break;
        case 's':
            lolas[ct] = new Singer;
            break;
        case 't':
            lolas[ct] = new SingerWaiter;
            break;
        default:
            break;
        }
        cin.get();
        lolas[ct]->Set();
    }

    cout<<"\nHrer is your staff:\n";
    int i;
    for ( i = 0; i < ct; i++)
    {
        cout<<endl;
        lolas[ct]->Show();
    }
    for ( i = 0; i < ct; i++)
    {
        delete lolas[i];
    }
    cout<<"Bye.\n";
    system("pause");
    return 0;
}